import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("member", { schema: "base-common" })
export class Member {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("varchar", { name: "account", length: 30 })
  account: string;

  @Column("char", { name: "password", length: 64 })
  password: string;

  @Column("char", { name: "salt", length: 12 })
  salt: string;

  @Column("tinyint", { name: "belong", comment: "归属", default: () => "'0'" })
  belong: number;

  @Column("int", { name: "creator_id", default: () => "'0'" })
  creatorId: number;

  @Column("int", { name: "tenant_id", default: () => "'0'" })
  tenantId: number;

  @Column("int", { name: "direct_leader", default: () => "'0'" })
  directLeader: number;

  @Column("json", { name: "depts", nullable: true, comment: "所属部门" })
  depts: object | null;

  @Column("int", { name: "direct_dept", default: () => "'0'" })
  directDept: number;

  @Column("varchar", { name: "name", length: 30 })
  name: string;

  @Column("varchar", { name: "tel", length: 11 })
  tel: string;

  @Column("tinyint", { name: "is_super", width: 1, default: () => "'0'" })
  isSuper: boolean;

  @Column("json", { name: "roles", nullable: true, comment: "角色" })
  roles: number[] | null;

  @Column("varchar", { name: "email", length: 100 })
  email: string;

  @Column("tinyint", { name: "enable", width: 1, default: () => "'0'" })
  enable: boolean;

  @Column("varchar", { name: "remark", length: 100 })
  remark: string;

  @Column("int", { name: "register_time", default: () => "'0'" })
  registerTime: number;

  @Column("int", { name: "last_login_time", default: () => "'0'" })
  lastLoginTime: number;

  @Column("varchar", { name: "last_ip", nullable: true, length: 19 })
  lastIp: string | null;
}
